import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CompanyGlobalCompactComponent } from './companyGlobalCompact.component';
import { CompanyGlobalCompactPillarComponent } from './companyGlobalCompactPillar/companyGlobalCompactPillar.component';
import { CompanyReportDownloadModule } from '../shared/companyHeader/companyReportDownload/companyReportDownload.module';
import { GlobalCompactOverviewComponent } from './global-compact-overview/global-compact-overview.component';
import { GlobalCompactPillarDetailComponent } from './global-compact-pillar-detail/global-compact-pillar-detail.component';

const routes: Routes = [
    {
        path: '',
        component: CompanyGlobalCompactComponent,
        children: [
            { path: '', redirectTo: 'overview', pathMatch: 'full' },
            {
                path: 'overview', component: GlobalCompactOverviewComponent,
                data: {
                    showAsMenu: true,
                    enabled: true,
                    menuItems: [{
                        title: 'Overview',
                        path: ['globalcompact', 'overview']
                    }]
                }
            }, {
                path: 'pillar/:id', component: GlobalCompactPillarDetailComponent, data: {
                    showAsMenu: true,
                    enabled: true
                }
            }
        ]
    },
    { loadChildren: './companyGlobalCompact.widget#WidgetModule' } // added to route so we generate a chunk for it
];

/**
 * Company global compact module
 *
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@NgModule({    
    imports: [
        CommonModule,
        FormsModule,
        CompanyReportDownloadModule,
        RouterModule.forChild(routes)
    ],
    declarations: [
        CompanyGlobalCompactComponent,
        CompanyGlobalCompactPillarComponent,
        GlobalCompactOverviewComponent,
        GlobalCompactPillarDetailComponent
    ]
})
export class CompanyGlobalCompactModule { }
